package cn.gpnusz.oliverwiki.controller;

import cn.gpnusz.oliverwiki.resp.CommonResp;
import cn.gpnusz.oliverwiki.resp.EbookSnapshotResp;
import cn.gpnusz.oliverwiki.service.EbookSnapshotService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;


/**
 * @author h0ss
 * @description 电子书快照的接口层
 * @date 2021/10/28 - 2:08
 */
@RestController
@RequestMapping("/ebook-snapshot")
public class EbookSnapshotController {
    @Resource
    private EbookSnapshotService ebookSnapshotService;

    /**
     * 获取点赞阅读数据的接口
     * @return : cn.gpnusz.oliverwiki.resp.CommonResp<java.lang.Object>
     * @author h0ss
     */
    @GetMapping("/get-static-data")
    public CommonResp<Object> getStaticData() {
        List<EbookSnapshotResp> data = ebookSnapshotService.getStaticData();
        CommonResp<Object> resp = new CommonResp<>();
        resp.setContent(data);
        return resp;
    }
    /**
     * 获取三十天数据的接口
     * @return : cn.gpnusz.oliverwiki.resp.CommonResp<java.lang.Object>
     * @author h0ss
     */
    @GetMapping("/get-thirty-static-data")
    public CommonResp<Object> getThirtyStaticData() {
        List<EbookSnapshotResp> data = ebookSnapshotService.getThirtyStaticData();
        CommonResp<Object> resp = new CommonResp<>();
        resp.setContent(data);
        return resp;
    }
}
